Allow close buttons on dialogs
authorMatthias Clasen <mclasen@redhat.com>
Fri, 20 Dec 2013 18:24:12 +0000 (13:24 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 20 Dec 2013 18:31:08 +0000 (13:31 -0500)
It was a long-standing problem for some users of GtkDialog that
there is no guaranted way to close it. So, lets show a close
button.

gtk/gtkheaderbar.c

index 3b49cb0033028e3eada5430c46ec1635acadb5af..1d8dac68b3e10d2f83865f26286f072313799453 100644 (file)
@@ -356,7 +356,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
               GtkWidget *image = NULL;
               AtkObject *accessible;
 
-              if (strcmp (t[j], "icon") == 0)
+              if (strcmp (t[j], "icon") == 0 &&
+                  gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_image_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
@@ -371,7 +372,9 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                       button = NULL;
                     }
                 }
-              else if (strcmp (t[j], "menu") == 0 && menu != NULL)
+              else if (strcmp (t[j], "menu") == 0 &&
+                       menu != NULL &&
+                       gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_menu_button_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
@@ -431,8 +434,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                   priv->titlebar_max_button = button;
                 }
               else if (strcmp (t[j], "close") == 0 &&
-                       gtk_window_get_deletable (window) &&
-                       gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
+                       gtk_window_get_deletable (window))
                 {
                   button = gtk_button_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);